package com.foreveross.vo;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Transient;

import org.hibernate.annotations.GenericGenerator;
import org.springframework.format.annotation.DateTimeFormat;

/**
 * TenementCost entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "tenement_cost", catalog = "hrtenement")
public class TenementCost implements java.io.Serializable {

	// Fields

	private String id;
	private String billNo;
	private String revID;
	private HouseUser houseUser;
	private HrHouses hrHouses;
	private Tenement tenement;
	private Double cost;
	private String ipItemName;
	@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
	private Date chargeTime;
	private Integer status;
	private String repYears;
	private String revAbstract;
	
	private String statusName;

	// Constructors

	/** default constructor */
	public TenementCost() {
	}

	/** minimal constructor */
	public TenementCost(String id) {
		this.id = id;
	}

	public TenementCost(String id, String billNo, String revID,
			HouseUser houseUser, HrHouses hrHouses, Tenement tenement,
			Double cost, String ipItemName, Date chargeTime, Integer status,
			String repYears, String revAbstract) {
		this.id = id;
		this.billNo = billNo;
		this.revID = revID;
		this.houseUser = houseUser;
		this.hrHouses = hrHouses;
		this.tenement = tenement;
		this.cost = cost;
		this.ipItemName = ipItemName;
		this.chargeTime = chargeTime;
		this.status = status;
		this.repYears = repYears;
		this.revAbstract = revAbstract;
	}
	
	@Id
	@GenericGenerator(name="idGenerator", strategy="uuid")
	@GeneratedValue(generator="idGenerator") 
	@Column(name = "id", unique = true, nullable = false, length = 32)
	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}
	
	@Column(name = "billNo")
	public String getBillNo() {
		return billNo;
	}

	public void setBillNo(String billNo) {
		this.billNo = billNo;
	}
	@Column(name = "revID")
	public String getRevID() {
		return revID;
	}

	public void setRevID(String revID) {
		this.revID = revID;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "user_id")
	public HouseUser getHouseUser() {
		return houseUser;
	}

	public void setHouseUser(HouseUser houseUser) {
		this.houseUser = houseUser;
	}
	
	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "house_id")
	public HrHouses getHrHouses() {
		return hrHouses;
	}

	public void setHrHouses(HrHouses hrHouses) {
		this.hrHouses = hrHouses;
	}
	
	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "tenement_id")
	public Tenement getTenement() {
		return tenement;
	}

	public void setTenement(Tenement tenement) {
		this.tenement = tenement;
	}
	@Column(name = "cost")
	public Double getCost() {
		return cost;
	}

	public void setCost(Double cost) {
		this.cost = cost;
	}
	@Column(name = "IpItemName")
	public String getIpItemName() {
		return ipItemName;
	}

	public void setIpItemName(String ipItemName) {
		this.ipItemName = ipItemName;
	}
	@Column(name = "charge_time")
	public Date getChargeTime() {
		return chargeTime;
	}

	public void setChargeTime(Date chargeTime) {
		this.chargeTime = chargeTime;
	}
	@Column(name = "status")
	public Integer getStatus() {
		return status;
	}

	public void setStatus(Integer status) {
		this.status = status;
	}
	@Column(name = "repYears")
	public String getRepYears() {
		return repYears;
	}

	public void setRepYears(String repYears) {
		this.repYears = repYears;
	}
	@Column(name = "revAbstract")
	public String getRevAbstract() {
		return revAbstract;
	}

	public void setRevAbstract(String revAbstract) {
		this.revAbstract = revAbstract;
	}

	@Transient
	public String getStatusName() {
		switch (status) {
		case 0:statusName = "未缴费";break;
		case 1:statusName = "已缴费";break;
		default:break;
		}
		return statusName;
	}

	public void setStatusName(String statusName) {
		this.statusName = statusName;
	}
}